<?php
/**
 * The following variables are available in this template:
 * - $this: the CrudCode object
 */
?>
<div class="wide form">

<?php echo "<?php \$form=\$this->beginWidget('CActiveForm', array(
    'id'=>'".$this->class2id($this->modelClass)."-form',
    'enableAjaxValidation'=>false,
)); ?>\n"; ?>

<p class="note"><?php echo "<?php echo Yii::t('site','Fields with {marker} are required.',array('{marker}'=>'<span class=\"required\">*</span>')); ?>"; ?></p>

    <?php echo "<?php echo \$form->errorSummary(\$model); ?>\n"; ?>

    <?php echo "<?php if(Yii::app()->getRequest()->getParam('".$this->modelClass."_page')) echo CHtml::hiddenField('".$this->modelClass."_page',Yii::app()->getRequest()->getParam('".$this->modelClass."_page')); ?>"; ?>

<?php
foreach($this->tableSchema->columns as $column)
{
    if($column->isPrimaryKey)
        continue;
?>
    <div class="row">
        <?php echo "<?php echo ".$this->generateActiveLabel($this->modelClass,$column)."; ?>\n"; ?>
        <?php echo "<?php echo ".$this->generateActiveField($this->modelClass,$column)."; ?>\n"; ?>
        <?php echo "<?php echo \$form->error(\$model,'{$column->name}'); ?>\n"; ?>
    </div>

<?php
}
?>
    <div class="row buttons">
        <?php echo "<?php \$this->widget( 'application.extensions.button.DDButton',\n" .
"\t\t\tarray(\n" .
"\t\t\t\t'title'=>\$model->isNewRecord?Yii::t('site','Create'):Yii::t('site','Save'),\n" .
"\t\t\t\t'linkTitle'=>\$model->isNewRecord?Yii::t('site','Create this record'):Yii::t('site','Save this record'),\n" .
"\t\t\t\t'formID' => '".$this->class2id($this->modelClass)."-form',\n" .
"\t\t\t\t'buttonType' => 'save'\n" .
"\t\t)); ?>\n"; ?>
        <?php echo "<?php \$this->widget( 'application.extensions.button.DDButton',\n" .
"\t\t\tarray(\n" .
"\t\t\t\t'title'=>Yii::t('site','Reset'),\n" .
"\t\t\t\t'linkTitle'=>Yii::t('site','Reset the form data'),\n" .
"\t\t\t\t'formID' => '".$this->class2id($this->modelClass)."-form',\n" .
"\t\t\t\t'buttonType' => 'reset',\n" .
"\t\t\t\t'confirm' => Yii::t('site','Really reset this form?')\n" .
"\t\t)); ?>\n"; ?>
        <?php echo "<?php \$this->widget( 'application.extensions.button.DDButton',\n" .
"\t\t\tarray(\n" .
"\t\t\t\t'title'=>Yii::t('site','Cancel'),\n" .
"\t\t\t\t'linkTitle'=>Yii::t('site','Cancel editing, back to list'),\n" .
"\t\t\t\t'formID' => '".$this->class2id($this->modelClass)."-form',\n" .
"\t\t\t\t'buttonType' => 'cancel',\n" .
"\t\t\t\t'confirm' => Yii::t('site','Really cancel editing this item?'),\n" .
"\t\t\t\t'url' => array('".strtolower($this->modelClass)."/admin','".$this->modelClass."_page'=>\$page)\n" .
"\t\t)); ?>\n"; ?>
    </div>

<?php echo "<?php \$this->endWidget(); ?>\n"; ?>

</div><!-- form -->
